package com.pkx.guide.info.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.guide.common.annotation.Log;
import com.pkx.guide.common.annotation.ORpose;
import com.pkx.guide.common.enums.BusinessType;
import com.pkx.guide.info.entity.TInfoGuideStatus;
import com.pkx.guide.info.service.TInfoGuideStatusService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 诱导屏状态表 控制器
 *
 * @author sunsy
 * @since 2023-12-20
 */
@RestController
@RequestMapping("/info/guideStatus")
@Tag(name = "诱导屏状态表")
@Slf4j
@ORpose
public class TInfoGuideStatusController {

    @Autowired
    private TInfoGuideStatusService tInfoGuideStatusService;

    @Operation(summary = "诱导屏状态表分页列表")
    @GetMapping("/page")
    public IPage<TInfoGuideStatus> page(Page page, TInfoGuideStatus tInfoGuideStatus) {
        return tInfoGuideStatusService.pageList(page,tInfoGuideStatus);
    }

    @Operation(summary = "诱导屏状态表列表")
    @GetMapping("/list")
    public List<TInfoGuideStatus> list(TInfoGuideStatus tInfoGuideStatus) {
        return tInfoGuideStatusService.listByEntity(tInfoGuideStatus);
    }

    @Operation(summary = "诱导屏状态表详情")
    @GetMapping(value = "/{id}")
    public TInfoGuideStatus selectById(@PathVariable("id") Integer id) {
        return tInfoGuideStatusService.selectById(id);
    }

    @Operation(summary = "诱导屏状态表新增")
    @PostMapping("/")
    @Log(title = "诱导屏状态表", businessType = BusinessType.INSERT)
    public Boolean add(@RequestBody TInfoGuideStatus tInfoGuideStatus) {
        return tInfoGuideStatusService.saveTInfoGuideStatus(tInfoGuideStatus);
    }

    @Operation(summary = "诱导屏状态表修改")
    @PutMapping("/")
    @Log(title = "诱导屏状态表", businessType = BusinessType.UPDATE)
    public Boolean modify(@RequestBody TInfoGuideStatus tInfoGuideStatus) {
        return tInfoGuideStatusService.modify(tInfoGuideStatus);
    }

    @Operation(summary = "诱导屏状态表删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    @Log(title = "诱导屏状态表", businessType = BusinessType.DELETE)
    public Boolean deleteById(@PathVariable("id") Integer id) {
        return tInfoGuideStatusService.deleteById(id);
    }
//    /**
//     * 查询离线设备
//     */
//    @GetMapping("/offlineDevice")
//    public List<TInfoGuideStatus> getOfflineDevice() {
//        return tInfoGuideStatusService.getOfflineDevice();
//    }
}
